/* ===========================================================================
   경기과학기술대학교 기숙사(다솜학사) 외박신청 — 디자인 시스템
   기준: gtec.ac.kr/dorm 홈페이지 (그린 계열)
   메인 그린 #419639 · 라임 액센트 #a7bf05 · 다크 네이비 #313c52
   =========================================================================== */

:root {
  --brand: #419639;
  --brand-dark: #2f7a2a;
  --brand-darker: #256321;
  --brand-light: #eaf5e9;
  --brand-tint: #f4faf3;
  --lime: #a7bf05;
  --navy: #313c52;
  --text: #222222;
  --text-muted: #555555;
  --text-soft: #777777;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --bg: #ffffff;
  --bg-soft: #f7f8f6;
  --danger: #d64545;
  --danger-bg: #fdecec;
  --warn: #b8860b;
  --ok: #2f7a2a;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.08);
  --maxw: 1080px;
  --font: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR",
    system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 상단 헤더 ------------------------------------------------------------ */
.site-header {
  background: #fff;
  border-top: 4px solid var(--brand);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .emblem { width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.brand .titles { line-height: 1.2; }
.brand .titles .univ { font-size: 13px; color: var(--text-muted); }
.brand .titles .name {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}
.brand .titles .name .sub { color: var(--text); font-weight: 700; }

/* 실제 GTEC 로고(경기과학기술대학교 기숙사) */
.brand-logo { height: 50px; width: auto; display: block; }
.brand .titles .name-sub { font-size: 16px; font-weight: 800; color: var(--brand-dark); letter-spacing: -0.02em; }
.brand .divider { width: 1px; height: 26px; background: var(--line-strong); }
/* 어두운 배경(사이드바/키오스크)용 흰색 로고 칩 */
.logo-chip { background: #fff; border-radius: 8px; padding: 8px 12px; display: inline-flex; align-items: center; }
.logo-chip img { height: 40px; width: auto; display: block; }

.top-nav { display: flex; align-items: center; gap: 6px; }
.top-nav a, .top-nav form button {
  font-size: 14px;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.top-nav a.active { color: var(--brand-dark); font-weight: 700; background: var(--brand-light); }

/* 언어 선택 드롭다운 */
.lang-select { position: relative; margin-left: 4px; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13px;
  padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); cursor: pointer;
}
.lang-btn:hover { background: var(--bg-soft); }
.lang-btn .caret { font-size: 10px; color: var(--text-soft); }
.lang-menu {
  position: absolute; top: 100%; right: 0; margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 140px; z-index: 60;
}
.lang-menu li a { display: block; padding: 8px 12px; border-radius: 5px; font-size: 13.5px; color: var(--text); }
.lang-menu li a:hover { background: var(--brand-light); text-decoration: none; }
.lang-menu li a.on { color: var(--brand-dark); font-weight: 700; background: var(--brand-light); }
/* 키오스크 다크 바 */
.kiosk-bar .lang-btn { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .35); color: #fff; }
.kiosk-bar .lang-btn:hover { background: rgba(255, 255, 255, .25); }
.kiosk-bar .lang-btn .caret { color: #fff; }
.top-nav a:hover, .top-nav form button:hover { background: var(--bg-soft); text-decoration: none; }

/* 페이지 상단 그린 밴드 */
.page-band { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; }
.page-band .inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 20px; }
.page-band h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.page-band p { margin: 6px 0 0; opacity: 0.92; font-size: 14px; }

/* ---- 레이아웃 ------------------------------------------------------------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 60px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand);
  display: inline-block;
}

/* ---- 폼 ------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 20px; }

/* 외박신청 폼 레이아웃(PC): 1행 이름·학과·연락처 / 2행 호실·행선지 / 3행 날짜 / 4행 비고 */
.leave-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px 20px; }
.leave-grid .field.c2 { grid-column: span 2; }
.leave-grid .field.c3 { grid-column: span 3; }
.leave-grid .field.c4 { grid-column: span 4; }
.leave-grid .field.c6 { grid-column: span 6; }
@media (max-width: 640px) {
  .leave-grid { grid-template-columns: 1fr; }
  .leave-grid .field { grid-column: auto !important; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; color: var(--text); }
.field label .req { color: var(--danger); margin-left: 3px; }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(65, 150, 57, 0.15);
}
.field textarea { resize: vertical; min-height: 84px; }
.field .hint { font-size: 12px; color: var(--text-soft); }

/* ---- 학과 커스텀 콤보박스(검색+수기입력) --------------------------------- */
.combo { position: relative; }
.combo-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto;
}
.combo-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 15px; color: var(--text);
}
.combo-item:hover { background: var(--brand-light); }
.combo-item .ci-name { font-weight: 600; }
.combo-item .ci-type { font-size: 12px; color: var(--text-soft); flex: none; }
.combo-item[hidden] { display: none; } /* 검색 필터 시 숨김(.combo-item의 display:flex 우선순위 보정) */

/* ---- 복귀신청 목록 -------------------------------------------------------- */
.return-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.return-item:last-of-type { border-bottom: 0; padding-bottom: 0; }
.return-dates { font-weight: 700; }
.return-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.return-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.extend-form { display: flex; gap: 6px; align-items: center; }
.extend-form input[type="date"] { padding: 8px 10px; font-size: 14px; }

/* ---- 버튼 ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.block { width: 100%; }
.btn.lg { font-size: 18px; padding: 15px 28px; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b23636; }
.btn.sm { font-size: 13px; padding: 7px 12px; font-weight: 600; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.actions { margin-top: 24px; display: flex; gap: 12px; justify-content: flex-end; }

/* ---- 알림 배너 ------------------------------------------------------------ */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; border: 1px solid transparent; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: #f3c2c2; }
.alert.info { background: var(--brand-light); color: var(--brand-darker); border-color: #cfe6cc; }
.alert.warn { background: #fdf6e3; color: var(--warn); border-color: #f0e2b8; }

/* ---- 배지/상태 ------------------------------------------------------------ */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; line-height: 1.6; }
.badge.pending { background: #fff3d6; color: #9a6a00; }
.badge.approved { background: var(--brand-light); color: var(--brand-darker); }
.badge.rejected { background: var(--danger-bg); color: var(--danger); }

/* ---- 통계 타일 ------------------------------------------------------------ */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 28px; font-weight: 800; color: var(--brand-dark); }
.stat .l { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stat.pending .n { color: #9a6a00; }
.stat.rejected .n { color: var(--danger); }

/* ---- 필터 바 -------------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.filter-bar .field { gap: 4px; }
.filter-bar label { font-size: 12px; color: var(--text-muted); }
.filter-bar input, .filter-bar select { padding: 8px 10px; font-size: 14px; }
.tabs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.tabs a { padding: 8px 14px; font-size: 14px; color: var(--text-muted); border-right: 1px solid var(--line); }
.tabs a:last-child { border-right: 0; }
.tabs a.on { background: var(--brand); color: #fff; }
.tabs a:hover { text-decoration: none; }
.tabs a.on:hover { background: var(--brand-dark); }

/* ---- 테이블 --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.list th { background: var(--bg-soft); color: var(--text-muted); font-weight: 700; font-size: 13px; border-bottom: 2px solid var(--line-strong); }
table.list tr:hover td { background: var(--brand-tint); }
table.list td.reason { white-space: normal; max-width: 240px; color: var(--text-muted); }
table.list .row-actions { display: flex; gap: 6px; }
.empty { text-align: center; color: var(--text-soft); padding: 40px 0; }

/* ---- 폼 섹션 제목 · 서류 체크 칩(사생 관리 상세/등록) ---------------------- */
.fsec {
  grid-column: 1 / -1;
  font-size: 13px; font-weight: 800; color: var(--brand-dark); letter-spacing: .02em;
  padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-top: 8px;
}
.form-grid .fsec:first-child { margin-top: 0; }
.fsec .cnt { font-weight: 600; color: var(--text-muted); margin-left: 6px; }
.clchips { display: flex; flex-wrap: wrap; gap: 8px; }
label.clchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer; background: #fff; user-select: none;
}
label.clchip input { accent-color: var(--brand); margin: 0; width: 15px; height: 15px; }
label.clchip:has(input:checked) {
  background: var(--brand-light); border-color: var(--brand); color: var(--brand-darker); font-weight: 700;
}

/* ---- 완료 화면 ------------------------------------------------------------ */
.done { text-align: center; padding: 20px 0 8px; }
.done .check { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-light); color: var(--brand); display: grid; place-items: center; margin: 0 auto 16px; font-size: 38px; }
.done h2 { border: 0; display: block; font-size: 22px; }
.summary { margin: 20px auto 0; max-width: 520px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.summary dl { margin: 0; display: grid; grid-template-columns: 130px 1fr; }
.summary dt { background: var(--bg-soft); padding: 11px 14px; font-weight: 600; font-size: 14px; color: var(--text-muted); border-bottom: 1px solid var(--line); }
.summary dd { margin: 0; padding: 11px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }

/* ---- 푸터 ----------------------------------------------------------------- */
.site-footer { background: var(--navy); color: #c9d0dd; font-size: 13px; }
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; padding: 22px 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.site-footer .ver { opacity: 0.7; }

/* ---- 로그인 --------------------------------------------------------------- */
.login-wrap { max-width: 400px; margin: 60px auto; }
.login-wrap .card { padding: 32px; }
.login-wrap h2 { display: block; text-align: center; border: 0; margin-bottom: 8px; }
.login-wrap .lead { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }

/* ---- 관리자 사이드바 레이아웃 -------------------------------------------- */
.admin-body { background: var(--bg-soft); }
.admin-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 240px; flex: none; background: var(--navy); color: #c9d0dd;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand:hover { text-decoration: none; }
.sb-titles { display: flex; flex-direction: column; line-height: 1.2; }
.sb-titles b { font-size: 16px; font-weight: 800; }
.sb-titles span { font-size: 12px; opacity: .75; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px; }
.nav-sec { font-size: 11px; letter-spacing: .04em; color: #8b93a7; padding: 14px 12px 6px; }
.sidebar-nav a { display: block; padding: 10px 12px; border-radius: 8px; color: #d7dce6; font-size: 14.5px; margin-bottom: 2px; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.sidebar-nav a.on { background: var(--brand); color: #fff; font-weight: 700; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-foot .who { font-size: 13px; margin-bottom: 10px; color: #c9d0dd; }
.admin-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { display: none; }
.sidebar-backdrop { display: none; }
/* 관리자 콘솔은 콘텐츠 영역 전체 폭을 사용(좌측 정렬 + 여백) */
.admin-body .page-band .inner { max-width: none; padding: 26px 32px; }
.admin-body main { max-width: none; margin: 0; padding: 28px 32px 60px; width: 100%; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar-toggle:checked ~ .admin-shell .sidebar { transform: translateX(0); }
  .admin-topbar {
    display: flex; align-items: center; gap: 12px; background: #fff;
    border-bottom: 1px solid var(--line); padding: 12px 16px; position: sticky; top: 0; z-index: 40;
  }
  .hamburger { font-size: 22px; cursor: pointer; line-height: 1; color: var(--brand-dark); user-select: none; }
  .topbar-title { font-weight: 700; }
  .sidebar-toggle:checked ~ .admin-shell .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 45;
  }
}

/* ---- 서비스 타일(포털/관리자 허브) --------------------------------------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile {
  display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  transition: transform .1s, box-shadow .1s, border-color .1s;
}
a.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.tile-ico { font-size: 40px; line-height: 1; }
.tile-title { font-size: 19px; font-weight: 800; color: var(--brand-dark); }
.tile-desc { font-size: 14px; color: var(--text-muted); }
.tile.disabled { opacity: .55; cursor: default; }

/* ---- 키오스크 모드 -------------------------------------------------------- */
body.kiosk { background: linear-gradient(160deg, #f4faf3, #eef4ee); min-height: 100vh; }
.kiosk-bar {
  background: linear-gradient(180deg, var(--brand), var(--brand-dark)); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 16px 28px;
}
.kiosk-brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 20px; }
.kiosk-brand:hover { text-decoration: none; }
.kiosk-brand b { font-weight: 800; }
.kiosk-clock { font-size: 16px; font-variant-numeric: tabular-nums; opacity: .95; }
.kiosk-main { max-width: 900px; margin: 0 auto; padding: 32px 24px 60px; }
.kiosk-hero { text-align: center; margin: 12px 0 32px; }
.kiosk-hero h1 { font-size: 34px; margin: 0 0 6px; color: var(--brand-darker); }
.kiosk-hero p { font-size: 17px; color: var(--text-muted); margin: 0; }
body.kiosk .tile-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
body.kiosk .tile { padding: 34px; align-items: center; text-align: center; }
body.kiosk .tile-ico { font-size: 56px; }
body.kiosk .tile-title { font-size: 24px; }
body.kiosk .tile-desc { font-size: 16px; }
body.kiosk .card { max-width: 760px; margin: 0 auto; }
body.kiosk .btn { font-size: 18px; padding: 15px 28px; }
body.kiosk .field input, body.kiosk .field select, body.kiosk .field textarea { font-size: 18px; padding: 14px; }

/* ---- 임베드(iframe) 모드 -------------------------------------------------- */
/* 홈페이지 게시물 등 외부 페이지에 삽입될 때: 사이트 헤더/푸터 없이 폼만, 배경 투명. */
body.embed { background: transparent; }
body.embed main { max-width: 720px; padding: 8px; }
body.embed .card { box-shadow: none; border: 1px solid var(--line); }

/* ---- 반응형 --------------------------------------------------------------- */
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .site-header .inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .top-nav { flex-wrap: wrap; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; }
  .summary dl { grid-template-columns: 100px 1fr; }
}
